#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<algorithm>

using namespace std;

const int N = 100010;

int n, m;
int cow[N];
double s[N];

bool check(double avg)
{
    for (int i = 1; i <= n; i++)   s[i] = s[i - 1] + cow[i] - avg;

    double minv = 0;
    for (int i = 0, j = m; j <= n; j++, i++)
    {
        minv = min(minv, s[i]);
        if (s[j] >= minv) return true;
    }
    return false;
}

int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++)    cin >> cow[i];

    double l = 0, r = 2000;
    while (r - l > 1e-5)
    {
        double mid = (l + r) / 2;
        if (check(mid))  l = mid;
        else r = mid;
    }
    printf("%d\n", (int)(r * 1000));
    return 0;
}